/*
 * Copyright (C) 2018 wxyz <hyhjwzx@126.com>
 * This program can be distributed under the terms of the GNU GPL Version 2.
 * See the file LICENSE.
 *
 */

package ren.wxyz.study.euler.hp01;

import ren.wxyz.study.euler.base.IProblem;
import ren.wxyz.study.euler.util.ConsoleHelper;

/**
 * 第 6 题
 *
 * @auther wxyz 2018-03-08_19:48
 * @since 1.0
 */
public class P006 implements IProblem {

    @Override
    public void main(String[] args) throws Throwable {
        int limitNumber = Integer.parseInt(args[0]);

        int sqrSum = 0;
        int sumSqr = 0;

        for (int i = 1; i <= limitNumber; i++) {
            sqrSum += i * i;
            sumSqr += i;
        }

        int res = sumSqr * sumSqr - sqrSum;
        ConsoleHelper.print("之差 " + res);
    }
}
